import { omit } from "@/utils"
import { ConfigContext } from "./context"
const ConfigProvider = (props) => {
    const { prefixCls, children } = props
    const getPrefixCls = (componentName, customPrefix) => {
        return `${customPrefix || prefixCls}-${componentName}`
    }
    const config = {
        ...omit(props, ["children"]),
        getPrefixCls
    }
    return <ConfigContext.Provider value={config}>{children}</ConfigContext.Provider>
}
ConfigProvider.ConfigContext = ConfigContext
ConfigProvider.displayName = "ConfigProvider"
export default ConfigProvider
export const ConfigConsumer = ConfigContext.Consumer
export { ConfigContext }